/*
 * server-side-provider
 * Copyright (C) Ivan Surzhenko 2009 <i.surzhenko@gmail.com>
 * 
 * server-side-provider is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * server-side-provider is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef CONNECTION_H_
#define CONNECTION_H_

#include "processor.h"
#include "log.h"

#include <sys/socket.h>       /*  socket definitions        */
#include <sys/types.h>        /*  socket types              */
#include <arpa/inet.h>        /*  inet (3) funtions         */
#include <unistd.h>           /*  misc. UNIX functions      */

#include <pthread.h>

#include <stdexcept>
#include <string.h>
#include <stdio.h>

using namespace std;

class Connection : public Processor
{
	public:
		Connection(int socket, RunMode mode = rm_Thread);
	
	protected:
		virtual void Process();
		
		virtual void OnRun();
		virtual void OnAfterRun();
		virtual void OnStop();
		virtual void OnAfterStop();
		
	private:
		int m_socket;
};

#endif /*CONNECTION_H_*/
